Arcade Solvers
==============

This folder contains the Windows/macOS client files needed to run the solver apps.
See Quick Commands.txt for copy-paste commands.

Requirements:
- Windows or macOS with Python 3.10 through 3.13 installed.
- Recommended installer for dependency compatibility:
  https://www.python.org/ftp/python/3.12.10/python-3.12.10-amd64.exe
- On Windows, check "Add python.exe to PATH" during Python install.
- On macOS, use python3 instead of python if that is how Python is installed.
- The phone or emulator and this computer must be on the same Wi-Fi/network.
- An API key for the solver service.

First-time setup:
1. Open Command Prompt or PowerShell in this folder.
2. Run python install.py. On macOS, run python3 install.py if python is not available.
   - This installs pygame for the game windows.
   - This also creates .mitm-venv for the proxy helper.
3. Run python start_proxy.py and keep that window open. On macOS, use python3 start_proxy.py if needed.
   - The capture helper shows the IP address, port, certificate link, and a live checklist.
   - If the phone connects but the certificate is not trusted, it will say exactly what to fix.
4. Follow the live checklist in start_proxy.py:
   - Set the phone/emulator Wi-Fi proxy to this computer's IP address and port 8080.
   - Open exactly http://mitm.it on the phone.
   - Install the mitmproxy certificate.
   - On iPhone, go to Settings > General > About > Certificate Trust Settings and enable mitmproxy.
   - Start a new game and wait for "Latest game capture is ready."
5. Run the matching solver:
   - python blackjack21.py
   - python blockparty.py
   - python solitaire.py
   - python wordlink.py
6. Press Solve and paste your API key. It is saved as .apikey only after the server accepts it.

Updating:
- Run python update.py to check for and install the newest Arcade Solvers client.
- On macOS, run python3 update.py if python is not available.
- Each solver, install.py, and start_proxy.py also checks for updates at startup.
- Updates preserve .apikey, latest_capture.json, .proxy_status.json, and .mitm-venv.

Files created locally:
- .apikey: your saved API key. Do not share this file.
- latest_capture.json: the latest captured game hash.
- .proxy_status.json: temporary proxy checklist status used by start_proxy.py.
- .mitm-venv/: the local mitmproxy environment used by start_proxy.py.
- VERSION: the installed Arcade Solvers client version.

Troubleshooting:
- Python 3.12.10 is recommended because pygame and mitmproxy have reliable dependency packages for it.
- If python install.py says compatible Python was not found, install Python 3.12.10 and check "Add python.exe to PATH".
- If no latest_capture.json appears, keep start_proxy.py running and follow the "Next step" line in that window.
- If start_proxy.py says the phone is connected but HTTPS is not trusted, install and fully trust the mitmproxy certificate.
- If start_proxy.py says port 8080 is already in use, close old proxy windows and run python start_proxy.py again.
- If the app says "Latest game capture is not for..." start the matching game and wait for latest_capture.json to update.
- If the app says "Solve error: No API solves left", ask for more solves on your API key.
- If the app says "Solve error: Entry type not supported yet", the captured hash format is not supported.
